import {useState,createContext,useContext} from 'react'

import React from 'react'
const {Provider} = createContext()


function B(){
    const msg = useContext(myConText)
    return (<div>
        <h3>bbb</h3>
    </div>
)}

function A(){
    return(
        <div>
            <h3>aaa</h3>
            <B />
        </div>
    )
}

export default function () {
    const [msg, setMsg] = useState('hello react')
  return (
    <div>
        <Provider value={msg}>
            <A />
        </Provider>
    </div>
  )
}
